import { createStore } from 'vuex';
const state = {
    user:{
        name:''
    }
}

const getters = {
    getUser(state){
        return state.user;
    }
}

const mutations = {
    updateUser(state,user){
        state.user = user;
    }
}

const actions = {
    asyncUpdateUser(context,user){
        context.commit('updateUser',user)
    }
}
// 创建并导出Vuex.Store实例
export default createStore({
    state,
    getters,
    mutations,
    actions
});
